<!doctype html>
	<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta content="telephone=no" name="format-detection" />
  
	<meta id="vieport" name="viewport" content="width=640, initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5">
	<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="js/jquery.nicescroll.js"></script>
	<script type="text/javascript" src="./js/home-jx.js?version=0310"></script>
	<script type="text/javascript" src="js/jquery.cookie.js"></script>
	<script src="js/base64.js"></script>
	<script type="text/javascript" src="js/jquery.alert.js"></script>
	<link rel="stylesheet" type="text/css" href="./css/jquery.alert.css" />
	<link rel="stylesheet" type="text/css" href="./css/home.css?version=0310" />
	<link rel="stylesheet" type="text/css" href="common.css" />
	<link rel="stylesheet" type="text/css" href="./css/common.css?version=0310" />
	<script type="text/javascript" src="js/common.js?version=0310"></script>
	<style></style>
	<script language="javascript">
	var natureid = $.cookie('NP_INFO_ID');
	var ukey = $.cookie('U_KEY');
	var phonenum = $.cookie('phoneNum');
	var newuser = $.cookie('newuser');
	var j = 1;
	var busi_id;
	var BST_SNAME;
	var busi_name;
	var RECOM_ARRID=getUrlParam("RECOM_ARRID");
	var orderId,mon2,desc;
	jQuery(document).ready(function() {
		if(versionFlag=="bj"){
			$('.diqu').hide();
		}else{
			$('#jxSelectNum').show();
		}
		$('#shensuo').hide();
		$('.xuanhao').hide();
		$('.tijiaochenggong').hide();
		 busi_id=getUrlParam("busi_id");
		 busi_name=decodeURI(getUrlParam("busi_name"));
		 BST_SNAME=decodeURI(getUrlParam("BST_SNAME"));
		 mon2=$.cookie("MON2")==null?"":$.cookie("MON2");
		 desc=$.cookie("DESC")==null?"":$.cookie("DESC");
		// alert(mon2);
		 //alert(desc);
		
		 $('.topCenter').text(busi_name);
		 var h='<div class="fontdemo" style="margin:0px auto";>'+
				'<div style="width: 100%;">'+busi_name+
				'<span style="margin-left:2%;font-size:24px; color:#cc0;">'+mon2+'</span>'+
				'<div style=" float:right; margin-top:23px; margin-right:-50px;">'+
				'</div>'+
				'<div style="width: 100%;font-size:24px;color:#666; text-align:center;">'+desc+'</div>'+
				'</div>';
		$('.yewuleixing').html(h);
		/*if(versionFlag=="jx"){
			$(".topCenter").text("3G号码")
		 	//$('.yewuleixing').text("推荐业务类型：   "+BST_SNAME);
		}*/
	 }); 
	function chksafe(a){
		//fibdn = new Array ("'" ,"\\","/",">","<");
		fibdn = new Array ("'",">","<","*","%","#","$","}","{","~","`","!","￥","/","?","&","^","(",")");
		i=fibdn.length;
		j=a.length;
		for (ii=0; ii<i; ii++) {
		for (jj=0; jj<j; jj++) {
		temp1=a.charAt(jj);
		temp2=fibdn[ii];
		if (temp1==temp2){
		return false;
		}
		}
		}
		return true;

		}
	function getUrlParam(name){	 
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
		   var r = window.location.search.substr(1).match(reg);   
		    if (r != null) {
			    return unescape(r[2]); 
		    }else{
			    return null;
		    }
	}
	function fanhuia(){	 
		var aas = $("#middlea").css("display");
		var chenggong = $(".tijiaochenggong").css("display");
		if(chenggong=="block"){
			window.history.go(-1);
			}else{
		
		if(aas=="none"){
			$('.xuanhao').hide();
			$('.caozuo').show();
			$('#middlea').show();
			}else{
				window.history.go(-1);
			}
			}
	}
	
		function guanbi(){

			
			$('#shensuo').show();
			$('#height').hide();
			$('#zhankai').hide();
			$('#username').text("客户名称1："+$('#nameinput').val());
			
		}



		
		function xuanhao(){

			$.natureajax({
				type: "get",
				url:jsonserver+"other_queryRegionList.do?",//获取JSON
				data:"callback=?&NP_INFO_ID="+natureid,
				dataType:"jsonp",
				success:function(json){
					if(json[0].result==1){
						if(json[1].length>0){
							//地域进行遍历
							var _html='';
							for(i=0;i<json[1].length;i++){		
								var obj = json[1][i];
								if(i==0){
									_html +='<option  selected="selected"  value="'+obj.AREA_ID+'">'+obj.NAME+'</option>';
									$.natureajax({
										type: "get",
										url:jsonserver+"home_SelectTelno.do?",
										data:"callback=?&phonenum="+phonenum+"&cityid="+obj.AREA_ID+"&busi_type_id="+RECOM_ARRID+"&Ukey="+ukey+"&pageno=1&page=4",
										dataType:"jsonp",
										success:function(json){
											if(json[0].result==1){
												if(json[1].length>0){
													$('#haoma0').html('');
													$('#haoma1').html('');
													$('#haoma2').html('');
													$('#haoma3').html('');
													//地域进行遍历
													for(i=0;i<json[1].length;i++){		
														var obj = json[1][i];

														$('#haoma'+i+'').html(obj.TELNO);
														
													}
													
												}else{
											jAlert("抱歉，没有可选的号码",'注销',function(e){});
                        }
											}
										},
										error:function(){
											jAlert("抱歉，出错了",'注销',function(e){});
										}
										
									});
									}else{
										_html +='<option   value="'+obj.AREA_ID+'">'+obj.NAME+'</option>';
									}
							}
							$(".selectQuyu").append(_html);
						}
					}
				},
				error:function(){
					jAlert("抱歉，出错了",'注销',function(e){});
				}
				
			});
			$('.xuanhao').show();
			$('.caozuo').hide();
			$('#middlea').hide();
			
		}
		function haomasheding(id){
			$('.xuanhao').hide();
			$('.caozuo').show();
			$('#middlea').show();
			$('#selectNo').val($('#'+id+'').text());
		}

		


		function sousuo(){
			$.natureajax({
				type: "get",
				url:jsonserver+"home_SelectTelno.do?",
				data:"callback=?&phonenum="+phonenum+"&cityid="+$('.selectQuyu').val()+"&busi_type_id="+RECOM_ARRID+"&Ukey="+ukey+"&pageno="+j+"&page=4&cond="+$('#sousuo').val(),
				dataType:"jsonp",
				success:function(json){
					if(json[0].result==1){
						if(json[1].length>0){
							$('#haoma0').html('');
							$('#haoma1').html('');
							$('#haoma2').html('');
							$('#haoma3').html('');
							//地域进行遍历
							for(i=0;i<json[1].length;i++){		
								var obj = json[1][i];
								$('#haoma'+i+'').html(obj.TELNO);
								
							}
							
						}else{
							jAlert("抱歉，没有可选的号码",'注销',function(e){});
						}
					}
				},
				error:function(){
					jAlert("抱歉，出错了",'注销',function(e){});
				}
				
			});
			
		}
		function fanye(id){
			if(id==1){
				j=j+1;
				$.natureajax({
					type: "get",
					url:jsonserver+"home_SelectTelno.do?",
					data:"callback=?&phonenum="+phonenum+"&cityid="+$('.selectQuyu').val()+"&busi_type_id="+RECOM_ARRID+"&Ukey="+ukey+"&pageno="+j+"&page=4",
					dataType:"jsonp",
					success:function(json){
						if(json[0].result==1){
							if(json[1].length>0){
								$('#haoma0').html('');
								$('#haoma1').html('');
								$('#haoma2').html('');
								$('#haoma3').html('');
								//地域进行遍历
								for(i=0;i<json[1].length;i++){		
									var obj = json[1][i];

									$('#haoma'+i+'').html(obj.TELNO);
									
								}
								
							}else{
								jAlert("抱歉，没有可选的号码。",'注销',function(e){
									
								});
							}
						}
					},
					error:function(){
						jAlert("抱歉，出错了",'注销',function(e){});
					}
					
				});
			}else{
				j=j>1?j-1:1;
				$.natureajax({
					type: "get",
					url:jsonserver+"home_SelectTelno.do?",
					data:"callback=?&phonenum="+phonenum+"&cityid="+$('.selectQuyu').val()+"&busi_type_id="+RECOM_ARRID+"&Ukey="+ukey+"&pageno="+j+"&page=4",
					dataType:"jsonp",
					success:function(json){
						if(json[0].result==1){
							if(json[1].length>0){
								$('#haoma0').html('');
								$('#haoma1').html('');
								$('#haoma2').html('');
								$('#haoma3').html('');
								//地域进行遍历
								for(i=0;i<json[1].length;i++){		
									var obj = json[1][i];

									$('#haoma'+i+'').html(obj.TELNO);
									
								}
								
							}else{
								jAlert("抱歉，没有可选的号码",'注销',function(e){
									
								});
							}
						}
					},
					error:function(){
						jAlert("抱歉，出错了",'注销',function(e){});
					}
					
				});
			}
		}
		function tijiao(){
			var strurl = '';
			 phonenum = $.cookie('phoneNum');
			var ukey = $.cookie('U_KEY');
			var selectNo=$('#selectNo').val();
			if(versionFlag=="bj"){
				selectNo="";
			}
			
			strurl +='[{"RECOM_ARRID":"'+RECOM_ARRID+'","RECOM_PHONENE":"'+$('#dianhua').val()+'","RECOM_RELATION":"1","RECOM_NATURE_FID":"'+$.cookie("NP_INFO_ID")+'","RECOM_NATURE_PHONENO":"'+phonenum+'","RECOM_BSS_TYPE_FID":"'+busi_id+'"'
			+',"RECOM_IDNO":"0","RECOM_NAME":"'+$('#nameinput').val()+'","THINK_NO":"'+selectNo+'","Ukey":"'+ukey+'","DEVICE":"wap","OI_PLATFORM":"wap"}]';
			if(($('#selectNo').val()=="" && versionFlag=="jx")||$('#nameinput').val()==""||$('#dianhua').val()==""){
				jAlert("你输入的为空",'注销',function(e){});
				return "";
			}
			var phoneParth =  /^1[3,5,8]\d{9}$/;
			var phoneNumber =  $('#dianhua').val();
			if(!phoneParth.exec(phoneNumber)){
				jAlert("你输入的电话号码不正确！",'注销',function(e){});
				return "";
			 }
			 var  inputname = $('#nameinput').val();
			 if(!chksafe(inputname)){
				 jAlert("客户名称不能输入非法字符!",'注销',function(e){});
				 return "";
				 }
			$.natureajax({
				type: "get",
				url:jsonserver+"recomm_insertcustomer.do?",

				data:"callback=?&batchs="+strurl,
				dataType:"jsonp",
				success:function(json){
					if(json[0].result==1){
						orderId = json[1][0].orderId;
						$('#shensuo').hide();
						$('.xuanhao').hide();
						$('.tijiaochenggong').show();
						$('#middlea').hide();
						$('.caozuo').hide();
						if(newuser=='isNull'){
							
						}else{
							$('#buchongliao').hide();
						}
					}
					else if(json[0].result==-1){
						jAlert("对不起服务器繁忙，请稍后再试",'注销',function(e){});
					}else{
						jAlert(json[0].info,'注销',function(e){});
					}
					
				},
				error:function(){
					jAlert("抱歉，出错了",'注销',function(e){});
				}
				
			});
		}
		function zhankai(){

			$('#zhankai').show();
			$('#height').show();
			$('#shensuo').hide();
		}
		function selecta(value){
			$.natureajax({
				type: "get",
				url:jsonserver+"home_SelectTelno.do?",
				data:"callback=?&phonenum="+phonenum+"&busi_type_id="+RECOM_ARRID+"&cityid="+value+"&Ukey="+ukey+"&pageno=1&page=4",
				dataType:"jsonp",
				success:function(json){
					if(json[0].result==1){
						if(json[1].length>0){
							$('#haoma0').html('');
							$('#haoma1').html('');
							$('#haoma2').html('');
							$('#haoma3').html('');
							//地域进行遍历
							for(i=0;i<json[1].length;i++){		
								var obj = json[1][i];

								$('#haoma'+i+'').html(obj.TELNO);
								
							}
							
						}else{
							jAlert("抱歉，没有可选的号码",'注销',function(e){});
						}
					}
				},
				error:function(){
					jAlert("出错了",'注销',function(e){});
				}
				
			});
		}
		function tianjia(){
			$("#zhengti").clone().prependTo($("#middlea"));
			var zhanlist = $(".zhankai");
			//alert(zhanlist.length);
			for(i=0;i<zhanlist.length;i++){
				document.getElementsByTagName("div")[i].id = "zhankai"+i;
				document.getElementsByTagName("shensuo")[i].id = "shensuo"+i;
			}
			
		}
		function jixutuijian(){
			window.history.go(-1);
		}
		function chadan(){
			 window.location.href='detailQuery.html?tabIndex=1&op=dfsdf ';
			
		}
		function shaidan(){
			var json = '[{"orderId": "'+orderId+'"}]';
			$.natureajax({
				type: "get",
				url:jsonserver+"home_wantSunsingle.do?",
				data:"callback=?&NP_INFO_ID="+natureid+"&sunsingleJson="+base64encode(json),
				dataType:"jsonp",
				success:function(json){
					
				},
				error:function(){
					jAlert("出错了",'注销',function(e){});
					return "";
				}
				
			}); 
			 window.location.href='shequ.html';
			
		}
	</script>
	<link type="text/css" href="css/business.css"  rel="stylesheet"/>
	<title>业务列表</title>
	<style>
input {
	height: 60px;
	border-radius: 6px;
	font-size: 30px;
	width:65%;
	border: 1px solid green;
}
</style>
	</head>
	<body onresize="resize()">
    <div id="bodyobj" class="bigimg" style="overflow: hidden;">
      <div id="header" style="text-align:center;" class="header">
        <table class="headerTal">
          <tr>
            <td class="menuTd" onclick="fanhuia()">返回</td>
            <td style="font-size:32px; color:#fff; width:60%;">推荐</td>
            <td width="30%"></td>
          </tr>
        </table>
      </div>
      <div id="home1" style=" width: 100%; "> 
        <!--页面主体开始-->
        <div class="topCenter"> 3G套餐 </div>
        <div class="yewuleixing"></div>
        <div class="middle" id="middlea">
          <div id="zhengti">
            <div class="zhankai" id="zhankai" name="zhankai">
              <table  style="text-align: center;margin-top: 10px;padding: 5x;width: 100%;font-size: 30px;color: #3C3C3C; ">
                <tr >
                  <td style="text-align:right; width:40%;">客户名称：</td>
                  <td style="text-align:left;" ><input type="text" value="" id="nameinput"/></td>
                </tr>
                <tr style="height: 15px;"></tr>
                <tr>
                  <td style="text-align: right;">联系电话：</td>
                  <td style="text-align:left;" ><input type="text" value="" id="dianhua" maxlength="11" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/></td>
                </tr>
                <tr style="height:  15px;"></tr>
                <tr id="jxSelectNum" style="display:none;">
                  <td style="text-align: right;">号码选定：</td>
                  <td style="text-align: left;" ><input type="text"  id="selectNo" disabled="disabled"/> <div style="font-size: 28px; width:110px; border-radius:15px; text-align:center; line-height:40px; height:40px; display:inline-table;background-color: #CEEDF7;" onclick="xuanhao()">选号</div></td>
                </tr>
              </table>
            </div>
            <div class="shensuo" id="shensuo" name="shensuo">
              <table style="text-align: center;padding: 5x;width: 100%;font-size: 22px;">
                <tr>
                  <td style="width: 60%;text-align: left;padding-left: 30px;" id="username"></td>
                  <td style="text-align: right;"><img src="image/icon_right_layer.png" style="margin-right: 15px;" onclick="zhankai()"/></td>
                </tr>
              </table>
            </div>
            <div style="height: 20px;" id="height"></div>
            <div class="shixian1"></div>
          </div>
        </div>
        <div class="caozuo">
          <div class="borderbutton1" onclick="tijiao()">提&nbsp;交</div>
        </div>
        <div class="xuanhao" >
          <div class="diqu">
            <select class="selectQuyu" onchange='selecta(this.value)'>
            </select>
          </div>
          <div class="biaoti">靓号选择：</div>
          <div class="zuoyouhenxian"><img src="./image/sep_line.png"/></div>
          <div class="haoduan" style="margin-top: 30px;">
            <table width="95%" style="margin-left: 2%;">
              <tr>
                <td rowspan="3" onclick="fanye(0)"><div class="zuojiantou"></div></td>
                <td class="borderHaoma" id="haoma0" onclick="haomasheding(this.id)"></td>
                <td style="width: 10px;"></td>
                <td class="borderHaoma" id="haoma1" onclick="haomasheding(this.id)"></td>
                <td rowspan="3" onclick="fanye(1)"><div class="youjiantou3"></div></td>
              </tr>
              <tr style="height: 25px;"></tr>
              <tr>
                <td class="borderHaoma" id="haoma2" onclick="haomasheding(this.id)"></td>
                <td></td>
                <td class="borderHaoma" id="haoma3" onclick="haomasheding(this.id)"></td>
              </tr>
            </table>
          </div>
          <div class="sousoukuang">
            <table style="width: 100%;text-align: center;">
              <tr>
                <td><input type="text" id="sousuo" style="margin-left: 5%" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/></td>
                <td style="padding-top: 17px;"><div class="sousuobng" onclick="sousuo()">搜索</div></td>
              </tr>
            </table>
          </div>
        </div>
      <div class="tijiaochenggong">
      	<div class="hanzi">
      		<table width="98%" style="margin-left: 20px;">
      			<tr>
      			<td rowspan="2"><div class="imgdui"></div></td>
      			<td class="successziti">提交成功！</td>
      			</tr>
      			<tr>
      			<td class="wanshanziti" ><div id="buchongliao">为了成功接收佣金<span  style="color: #f07d20;" onclick="window.location.href='userInfo.html'">请完善账户资料</span></div></td>
      			</tr>
      		</table>
      	</div>
      	<div class="shixian3"></div>
      <div class="sankuang">
      <table style="width: 95%;margin-left: 15px;margin-right: 15px;margin-top: 30px;">
      	<tr>
      		<td class="sankuangzi" onclick="jixutuijian()">继续推荐</td>
      		<td style="width:15px; "></td>
      		<td class="sankuangzi" onclick="chadan()">查单</td>
      		<td style="width:15px; "></td>
      		<td class="sankuangzi" onclick="shaidan()">我要晒单</td>
      	</tr>
      </table>
      </div>
      </div>
        <div style="height: 30px;" ></div>
        <!--页面主体结束--> 
      </div>
      <div class="bottom"></div>
    </div>
    
    <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    
</body>
</html>
